#include <QtGui/QApplication>
#include "qmlapplicationviewer.h"

#include "gameengine.h"
#include <QDeclarativeEngine>
#include <QDeclarativeContext>

#ifdef HAVE_GLWIDGET
#include <QGLWidget>
#endif


int main(int argc, char *argv[])
{

#ifndef Q_OS_SYMBIAN
    QApplication::setGraphicsSystem("raster");
#endif
    QApplication app(argc, argv);

    QmlApplicationViewer viewer;

#ifdef HAVE_GLWIDGET

    QGLWidget *glWidget = new QGLWidget(&viewer);
    viewer.setViewport(glWidget);
#endif
    viewer.setWindowTitle("QatBowling");

    viewer.setAttribute(Qt::WA_NoSystemBackground);
    GameEngine* eng = new GameEngine(&viewer);
    viewer.engine()->rootContext()->setContextProperty("engine", eng);


    viewer.setOrientation(QmlApplicationViewer::ScreenOrientationLockLandscape);
    viewer.setMainQmlFile(QLatin1String("qml/catbowling/main.qml"));
    eng->setGameQml(viewer.rootObject());
    viewer.showFullScreen();

    //eng->findQmlObjects();

    return app.exec();
}
